﻿/* AgileFx Version 1.0
 * An open-source framework for rapid development of applications and services using Microsoft.net
 * Developed by: AgileHead
 * Website: www.agilefx.org
 * This component is licensed under the terms of the Apache 2.0 License.
 */

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.Mvc;

using AgileFx.EF;

namespace AgileFx.MVC
{
    public class DefaultView
    {
        public string PageTitle { get; set; }
        public string SelectedMenuItem { get; set; }
        public string SelectedSubMenuItem { get; set; }
        public string MessageCode { get; set; }

        private List<Message> errors = new List<Message>();
        public List<Message> Errors
        {
            get
            {
                return errors;
            }
        }

        public void AddError(string errorCode)
        {
            Errors.Add(new Message(errorCode));
        }

        public void AddError(string errorCode, params string[] relatedProperty)
        {
            Errors.Add(new Message(errorCode, relatedProperty));
        }

        public void AddErrors(IEnumerable<Message> errors)
        {
            Errors.AddRange(errors);
        }
    }
}
